﻿<UserControl x:Class="Squiggle.UI.Controls.MessageEditBox"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <UserControl.Resources>
        <Style x:Key="BorderStyle" TargetType="{x:Type Border}">
            <Setter Property="BorderBrush" Value="#FFBFCBD8" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="CornerRadius" Value="3" />
            <Setter Property="HorizontalAlignment" Value="Stretch" />
            <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding EditMode}" Value="True">
                    <Setter Property="Background" Value="LightYellow" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="TextStyle" TargetType="{x:Type TextBox}">
            <Setter Property="Margin" Value="2,2,0,2" />
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="BorderBrush" Value="{x:Null}" />
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="HorizontalAlignment" Value="Stretch" />
            <Setter Property="VerticalAlignment" Value="Stretch" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding EditMode}" Value="True">
                    <Setter Property="Background" Value="LightYellow" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="ButtonStyle" TargetType="{x:Type Button}">
            <Setter Property="Background" Value="{StaticResource {x:Static SystemColors.WindowBrushKey}}" />
            <Setter Property="Width" Value="60" />
            <Setter Property="Margin" Value="10"/>
            <Setter Property="FontWeight" Value="Bold" />
            <Setter Property="BorderBrush" Value="Orange" />
            <Setter Property="BorderThickness" Value="1" />
        </Style>
        </UserControl.Resources>

        <Border Style="{StaticResource BorderStyle}">
        <Grid Focusable="True">            
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="80" />
            </Grid.ColumnDefinitions>
            <TextBox AllowDrop="True" x:Name="txtMessage" Text="{Binding Message, UpdateSourceTrigger=PropertyChanged}"
                    TabIndex="0"  Style="{StaticResource TextStyle}" 
                    AcceptsReturn="True" VerticalScrollBarVisibility="Auto"
                    TextChanged="txtMessage_TextChanged" PreviewKeyDown="txtMessage_PreviewKeyDown" TextWrapping="Wrap" />
            <Button TabIndex="1" x:Name="btnSend" IsEnabled="False" HorizontalAlignment="Right" Height="60" Grid.Column="1"
                    Content="{DynamicResource ChatWindow_SendButton}" ToolTip="{DynamicResource ChatWindow_SendButtonToolTip}" 
        Style="{StaticResource ButtonStyle}" Click="btnSend_Click" />
        </Grid>
    </Border>

</UserControl>

